<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class StoreCashierSwitchCodeGroup extends Model
{
    protected $table = 'ims_yz_store_cashier_switch_code_group';
    
    protected $fillable = [
        'name',
        'uniacid',
        'created_at',
        'updated_at',
        'is_delete',
        'is_first'
    ];
    
    public $timestamps = false;
    
    /**
     * 获取分组属性
     */
    public function properties()
    {
        return $this->hasMany(StoreCashierSwitchCodeGroupProperties::class, 'pid');
    }
    
    /**
     * 获取分组关系
     */
    public function relations()
    {
        return $this->hasMany(StoreCashierSwitchCodeGroupRelation::class, 'group_id');
    }
    
    /**
     * 获取启用的分组
     */
    public function scopeActive($query)
    {
        return $query->where('is_delete', 0);
    }
}